﻿using System;
using System.Text;
using System.Data;
using System.Collections.Generic;
using System.Collections;

namespace NBox.Service.Mapping
{
    public interface IObjectConvertor
    {
        #region ToObject

        #region Generic
        /// <summary>
        /// 	Convert to outputType
        /// </summary>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        OutputType ToObject<OutputType>(object inputObject)
            where OutputType : class;

        /// <summary>
        /// 	Convert to outputType
        /// </summary>
        /// <typeparam name="InputType">The type of the input type.</typeparam>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        OutputType ToObject<InputType, OutputType>(InputType inputObject)
            where InputType : class
            where OutputType : class;

        /// <summary>
        /// 	Convert to outputType
        /// </summary>
        /// <typeparam name="InputType">The type of the nput type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <typeparam name="InitType">The type of the nit type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        OutputType ToObject<InputType, OutputType, InitType>(InputType inputObject)
            where OutputType : class
            where InitType : class;

        OutputType ToObject<InputType, OutputType, InitType>(InputType inputObject, string viewName);

        /// <summary>
        /// 	Convert to outputType
        /// </summary>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        OutputType ToObject<OutputType>(object inputObject, string viewName)
            where OutputType : class;

        /// <summary>
        /// 	Convert to outputType
        /// </summary>
        /// <typeparam name="InputType">The type of the nput type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        OutputType ToObject<InputType, OutputType>(InputType inputObject, string viewName)
            where InputType : class
            where OutputType : class;
        #endregion

        #region Common
        /// <summary>
        /// 	convert to object
        /// </summary>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="inputObject">The input object.</param>
        /// <returns></returns>
        object ToObject(Type inputType, Type outputType, Type initType, object inputObject);

        /// <summary>
        /// 	convert to object
        /// </summary>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="inputObject">The input object.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        object ToObject(Type inputType, Type outputType, Type initType, object inputObject, string viewName);

        object ToObject(Type inputType, Type outputType, object inputObject, object outputObject);

        object ToObject(Type inputType, Type outputType, object inputObject, object outputObject, string viewName);
        #endregion

        /// <summary>
        /// Toes the object.
        /// </summary>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <param name="outputObject">The output object.</param>
        /// <returns></returns>
        OutputType ToObject<OutputType>(object inputObject, OutputType outputObject)
            where OutputType : class;
        /// <summary>
        /// Toes the object.
        /// </summary>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <param name="outputObject">The output object.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType ToObject<OutputType>(object inputObject, OutputType outputObject, string viewName);
        /// <summary>
        /// Toes the object.
        /// </summary>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <param name="outputObject">The output object.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType ToObject<OutputType>(object inputObject, OutputType outputObject, System.Collections.Specialized.NameValueCollection config);

        /// <summary>
        /// Toes the object.
        /// </summary>
        /// <typeparam name="InpuType">The type of the npu type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <param name="outputObject">The output object.</param>
        /// <returns></returns>
        OutputType ToObject<InputType, OutputType>(InputType inputObject, OutputType outputObject)
            where InputType : class
            where OutputType : class;
        /// <summary>
        /// Toes the object.
        /// </summary>
        /// <typeparam name="InpuType">The type of the npu type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.</param>
        /// <param name="outputObject">The output object.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType ToObject<InputType, OutputType>(InputType inputObject, OutputType outputObject, string viewName)
            where InputType : class
            where OutputType : class;
        #endregion

        #region ToArray

        /// <summary>
        /// convert to object list
        /// </summary>
        /// <typeparam name="InputType">The type of the input type.</typeparam>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputList">The input list.(IEnumerable or DataTable or DataReader)</param>
        /// <returns></returns>
        OutputType[] ToArray<InputType, OutputType>(object inputList)
            where InputType : class
            where OutputType : class;

        /// <summary>
        /// 	convert to object list
        /// </summary>
        /// <typeparam name="InputType">The type of the nput type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <typeparam name="InitType">The type of the nit type.</typeparam>
        /// <param name="inputObject">The input object.(IEnumerable or DataTable or DataReader)</param>
        /// <returns></returns>
        OutputType[] ToArray<InputType, OutputType, InitType>(object inputList)
            where InputType : class
            where OutputType : class
            where InitType : class;

        /// <summary>
        /// 	convert to object list
        /// </summary>
        /// <typeparam name="InputType">The type of the nput type.</typeparam>
        /// <typeparam name="OutputType">The type of the utput type.</typeparam>
        /// <param name="inputObject">The input object.(IEnumerable or DataTable or DataReader)</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType[] ToArray<InputType, OutputType>(object inputList, string viewName)
            where InputType : class
            where OutputType : class;

        /// <summary>
        /// 	convert to list
        /// </summary>
        /// <typeparam name="InputType">The type of the input type.</typeparam>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <typeparam name="InitType">The type of the init type.</typeparam>
        /// <param name="inputList">The input list.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType[] ToArray<InputType, OutputType, InitType>(object inputList, string viewName)
            where InputType : class
            where OutputType : class
            where InitType : class;

        /// <summary>
        /// 	convert to list
        /// </summary>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        OutputType[] ToArray<OutputType>(object inputList, Type inputType, Type initType, string viewName)
            where OutputType : class;

        /// <summary>
        /// 	ToArray
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <returns></returns>
        object[] ToArray(object inputList, Type inputType, Type outputType);
        /// <summary>
        /// 	ToArray
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        object[] ToArray(object inputList, Type inputType, Type outputType, string viewName);
        /// <summary>
        /// 	ToArray
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        object[] ToArray(object inputList, Type inputType, Type outputType, Type initType, string viewName);
        /// <summary>
        /// 	ToArray
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="outputType">Type of the output.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        object[] ToArray(object inputList, Type inputType, Type outputType, System.Collections.Specialized.NameValueCollection config);

        #endregion

        #region ToList

        /// <summary>
        /// 	convert to list // By Xsword
        /// </summary>
        /// <typeparam name="OutputType">The type of the output type.</typeparam>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="initType">Type of the init.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        List<OutputType> ToList<OutputType>(object inputList, Type inputType, Type initType, string viewName)
            where OutputType : class;
        #endregion

        #region ToDataTable

        /// <summary>
        /// 	convert to DataTable
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <returns></returns>
        DataTable ToDataTable(object inputList, Type inputType);
        DataTable ToDataTable(object inputList, Type inputType, DataRowState rowState);
        /// <summary>
        /// 	convert to DataTable
        /// </summary>
        /// <param name="inputList">The input list.</param>
        /// <param name="inputType">Type of the input.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <returns></returns>
        DataTable ToDataTable(object inputList, Type inputType, string viewName, DataRowState rowState);

        #endregion
    }
}
